﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utility;
using BLL;
using System.Data;
 

public partial class Month_ModifyMonthHandShakeMeeting : System.Web.UI.Page
{
    MonthHandShakeManager dllMonthHandShakeManager = new MonthHandShakeManager();
    Model.UserInfo objUserInfo = new Model.UserInfo();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
            if (objUserInfo.UserName == "admin")
            {
                this.btnSave.Enabled = true;
            }
            else
            {
                this.btnSave.Enabled = false;
            }
        }
    }

    void Bind()
    {
        object[] _value = new object[1];
        _value[0] = Utility.HttpHelp.getParamsInt("HandShakeId");
        DataTable _monthHandShake = dllMonthHandShakeManager.get(MonthHandShakeManager.field.HandShakeId.ToString(), _value);
        if (_monthHandShake.Rows.Count > 0)
        {
            this.txtMeetingContent.Text = _monthHandShake.Rows[0]["MeetingContent"].ToString();
        }
    }


    /// <summary>
    /// 保存会议记录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        object[] _value = new object[2];
        _value[0] = Utility.HttpHelp.getParamsInt("HandShakeId");
        _value[1] = this.txtMeetingContent.Text;
        int val = dllMonthHandShakeManager.edit(MonthHandShakeManager.field.MeetingContent.ToString(), _value);
        if (val > 0)
        {
            int MonthDate = Utility.HttpHelp.getParamsInt("MonthDate");
            int Year = Utility.HttpHelp.getParamsInt("Year");
            int QuarterDate = Utility.HttpHelp.getParamsInt("QuarterDate");
            Utility.HttpHelp.closeWindow("MonthHandShake.aspx?MonthDate=" + MonthDate + "&Year=" + Year + "&QuarterDate=" + QuarterDate, this.Page);
            //Page.RegisterStartupScript("refresh", "<script>window.opener.location.href=window.opener.location.href;self.close();</script>");
        }
        else
        {
            Utility.Error.RedirectErrorPage("修改月握手会议记录未成功，请重试！");            
        }
    }
}
